// 定义二级路由
// 左侧菜单项匹配


import React from 'react';
import { Route, Switch, Redirect } from 'react-router-dom';
import { lazy, Suspense } from 'react';
import Loading from '@/components/Loading';

const Welcome = lazy(() => import('@/views/dashboard/Welcome'));
const Userlist = lazy(() => import('@/views/dashboard/user/Index'));
const Filmlist = lazy(() => import('@/views/dashboard/film/Index'));
const Cinemalist = lazy(() => import('@/views/dashboard/cinema/Index'))
const Collegelist = lazy(() => import('@/views/dashboard/college/Index'))
const Admin = () => {
    return (
        <Suspense fallback={<Loading></Loading>}>
            <Switch>
                <Route path='/dashboard/welcome' component={Welcome}></Route>
                <Route path='/dashboard/user/index' component={Userlist}></Route>
                <Route path='/dashboard/film/index' component={Filmlist}></Route>
                <Route path='/dashboard/cinema/index' component={Cinemalist}></Route>
                <Route path='/dashboard/college/index' component={Collegelist}></Route>
                <Redirect from='/dashboard' to='/dashboard/welcome' exact></Redirect>
            </Switch>
        </Suspense>
    );
}

export default Admin;
